import scala.beans.BeanProperty

class Dog {
  @BeanProperty
  var name: String = ""
  @BeanProperty
  var age: Int = 0


  def this(name: String, age: Int) = {
    this()
    this.name = name
    this.age = age
  }

  def eat() {
    println(name + "在吃吃吃")
  }

  override def toString: String = {
    "name:" + name + " age:" + age
  }
}

object Dog {
  def main(args: Array[String]) {
    var dog = new Dog()
    dog.age = 2
    dog.name = "小黑"
    println(dog.name)
    println(dog.age)
    println(dog.toString)
    dog.setName("大黑")
    dog.eat()
    dog = new Dog("小花", 3)
    println(dog.toString)
  }
}